
import compressing from 'compressing';
import * as esbuild from 'esbuild';
import fse from 'fs-extra';
import path from 'path';

const outDir = './dist/';

let entryPoints = ['audio_reply.js'];
const configFile = ['pull_audio.config.json'];

configFile.map(v => {
  fse.copySync(v, path.join(outDir, v));
});

await esbuild.build({
  bundle: true,
  entryPoints: entryPoints,
  outdir: outDir,
  format: 'cjs',
  platform: 'node',
  target: 'node14',
  outExtension: { '.js': '.cjs' }
});

await compressing.zip.compressDir('dist', 'audio_reply.zip');